GBML manual / Backgrounds

zoom_background_priority

Sets which of the 4 hardware layers the room’s zoomable background draws on - 0 is frontmost, 3 is backmost. It starts on 3.

Game Boy: not available

Game Boy Color: not available

Sega Genesis: not available

On other consoles this differs: see Side by side and How the consoles differ.

Syntax

zoom_background_priority(priority)

Arguments

NameType
priorityint

Returns

Nothing.

Description

Sets which of the 4 hardware layers the room's zoomable background is drawn on. 0 is frontmost and 3 is backmost. It starts on 3. A number outside 0 to 3 is moved to the nearest end. It does nothing in a room that has no zoomable background.

When a regular background and the zoomable one are on the same layer, the regular one is drawn in front. That is a rule of the hardware, not something you can change. A room's floor sits on layer 3 as well, so a new zoomable background is drawn behind the floor. Give it 2 or lower to bring it in front of the floor, which is what a map screen wants. Leave it on 3 to keep the floor in front, which is what a scrolling sky wants.

Sprites are drawn in front of a background on the same layer as them, so an instance left on its default bg_priority of 3 is drawn in front of a zoomable background left on 3 too.

Example

// Create event of the object that runs the map screen.
zoom_background_priority(0);

The map is drawn in front of the room's floor and everything else on layers 1 to 3, which is what you want when the map fills the screen.

On the GBA

A no-op in a room that has no zoomable background. A number outside 0 to 3 is held to that range. A tie between a regular background and the zoomable one always goes to the regular one - the room’s floor sits on 3 too, so a new zoomable background is drawn behind it. Give it 2 or lower to bring it in front of the floor (a map screen, say), or leave it on 3 to keep the floor in front.

See also: Zoomable backgroundszoom_background_visiblebackground_prioritybg_priority